package com.madou.dbtool.redis.event;

import com.madou.dbtool.event.DBEvent;
import com.madou.dbtool.event.IdEvent;
import com.madou.dbtool.redis.manager.RedisNodeInfo;
import com.madou.dbtool.redis.manager.RedisSourceManager;

/**
 * 打开redis节点慢日志终端事件
 * @author miukoo
 */
public class OpenRedisSlowLogEvent extends IdEvent implements DBEvent {

    // 只用于事件的注册引用
    public static final OpenRedisSlowLogEvent NAME = new OpenRedisSlowLogEvent("",null,null);
    // 资源管理器
    RedisSourceManager redisSourceManager;
    // 节点新
    RedisNodeInfo redisNodeInfo;
    int dbIndex=0;

    public OpenRedisSlowLogEvent(String id, RedisSourceManager redisSourceManager, RedisNodeInfo redisNodeInfo){
        this(id,redisSourceManager,redisNodeInfo,0);
    }

    public OpenRedisSlowLogEvent(String id, RedisSourceManager redisSourceManager, RedisNodeInfo redisNodeInfo,int dbIndex){
        this.redisSourceManager = redisSourceManager;
        this.redisNodeInfo = redisNodeInfo;
        this.dbIndex = dbIndex;
    }

    @Override
    public String name() {
        return "OpenRedisSlowLogEvent";
    }

    public RedisSourceManager getRedisSourceManager() {
        return redisSourceManager;
    }

    public RedisNodeInfo getRedisNodeInfo() {
        return redisNodeInfo;
    }

    @Override
    public String id(){
        return this.id;
    }

    public int getDbIndex() {
        return dbIndex;
    }

}
